package com.bbs.service.impl;

import com.bbs.domain.Reply;
import com.bbs.mapper.ReplyMapper;
import com.bbs.service.ReplyService;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ReplyServiceImpl
 * @Description TODO
 * @Author chen hong wei
 * @Date 2019/9/22 22:45
 */
@Service
public class ReplyServiceImpl implements ReplyService {


    @Autowired
    private ReplyMapper replyMapper;

    /**
     * @return java.util.List<com.bbs.domain.Reply>
     * @author chen hong wei
     * @Description 根据评论id查询评论
     * @Date 22:48 2019/9/22
     * @Param [commentid]
     **/
    @Override
    public List<Reply> findReplyByCommentId(Integer commentid) {
        Example example = new Example(Reply.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("commentid", commentid);
//        example.setOrderByClause("replytime desc");
        List<Reply> replyList = replyMapper.selectByExample(example);
//        Map<Integer, List<Reply>> replyMap = new HashMap<>();
//        replyMap.put(commentid, replyList);
        return replyList;
    }
}